﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

using com.vs.General;
using com.vs.DataAccess;

namespace com.vs.General.BL
{
    public class NextNumberManager
    {
        public static string GetNextNumber(Session sess, string stNextNumKey)
        {
            DataHelper helper = null;

            try
            {
                helper = new DataHelper(sess);
                return helper.GetString(CommandType.StoredProcedure, "NBR_RNextNumber", new IDataParameter[]{
                        DataHelper.BuildParameter(sess, "@NEXT_NUM_KEY", stNextNumKey)
                    });
            }
            catch (Exception e)
            {
                ExceptionManager.LogException(sess, e);
                return MessageManager.MSG_GEN_000 + e.Message;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
        }
    }
}
